package com.twu.biblioteca;

import java.lang.*;
import java.*;
import com.twu.biblioteca.*;

public class UserDetail {
    String userName;
    String memberId;
    String password;
    String emailAddress;
    long phoneNumber;

    StringBuilder sb = new StringBuilder();

    UserDetail(String name,String id, String pwd, String emailAddress, long phoneNumber){
        this.userName=name;
        this.memberId=id;
        this.password=pwd;
        this.emailAddress=emailAddress;
        this.phoneNumber=phoneNumber;
    }

    public boolean login(String id,String pass)
    {
      if (memberId.compareTo(id)==0 && password.compareTo(pass)==0)
         return true;
      else
      {
         System.out.println("Enter a valid Member Id and Password ");
         return false;
      }
    }

    public String getMembershipDetails(String id,String pwd){

        if(login(id,pwd)){

            sb.append(userName+"-");
            sb.append(emailAddress+"-");
            sb.append(phoneNumber);

        }
        else
        sb.append("Please talk to a Librarian. Thank you");
        return sb.toString();
    }
}
